<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/common.css?01_24" />
		<link rel="stylesheet" type="text/css" href="../css/templet.css?01_24" />
		<link rel="stylesheet" type="text/css" href="../fonts/font-awesome.min.css?01_24" />
		<link rel="stylesheet" type="text/css" href="../mui/css/mui.css?01_24" />

		<!--公共js-->
		<script type="text/javascript" src="../common/js/jquery.js?01_24"></script>
		<script type="text/javascript" src="../common/js/fastclick.js?01_24"></script>
		<script type="text/javascript" src="../common/js/common.js?01_24"></script>
		<script type="text/javascript" src="../common/js/my_common.js?01_24"></script>
		<script type="text/javascript" src="../common/js/main.js?01_24"></script>
		<script type="text/javascript" src="../common/js/app.js?01_24"></script>
		<!--插件-->
		<script type="text/javascript" src="../common/js/vue.min.js?01_24"></script>
		<script type="text/javascript" src="../common/js/mui.min.js?01_24"></script>
	</head>

	<body>
		<header class="pr bg-red9 fff f-20 pad-t-10 pad-b-25 pad-r-10">
			<div class="pa back pad-l-10 re" onclick="cli_backpre()">
				<div class="order_back"></div>
				<a></a>
			</div>
			<div class="center"></div>
			<div onclick="clicked('writeOffRecord.html')" class="pa see f-14 re" style="right:10px;">
				<div class="order_back_1"></div>
				<span class="fff" data-l="1334"></span>
			</div>
		</header>
		<div id="app" v-cloak>
			<div class="wrap_body discount_coupon" style="max-height: 100vh; min-height: auto;">
				<div class="content">
					<!--搜索部分-->
					<div class="top bg-red9 pad-l-10 pad-r-10 pad-t-25">
						<p class="fff f-24">{{b_lg[1224]}}</p>
						<div class="bg-fff fiex pad-r-20 search" style="height: 5.15em;">
							<div class="fiex1 fiex">
								<div class="pad-t-20 pad-b-20 pad-l-12 pad-r-12 bk col-sm-11 c999 f-20" v-if="couponSn==''">{{b_lg[1335]}}</div>
								<div class="pad-t-20 pad-b-20 pad-l-12 pad-r-12 bk col-sm-11 f-24" v-else>{{couponSn}}</div>
								<!--<input type="search" disabled="" :placeholder="b_lg[1335]" class="pad-t-20 pad-b-20 pad-l-12 pad-r-12 bk col-sm-11 f-24" v-model="couponSn"/>-->
							</div>
							<div class="scan" @click="scan"></div>
						</div>
					</div>

					<div class="pad-r-10 pad-l-10 pad-t-70 center">
						<div>
							<a class="bg-red9 fff pad-t-15 pad-b-15 pad-l-70 pad-r-70 f-15 btn" @click="sure">{{b_lg[1008]}}</a>
						</div>
					</div>
				</div>

				<div class="number-key">
					<ul class="cf f-24">

						<li @touchstart="numberk(1)"><span>1</span></li>
						<li @touchstart="numberk(2)"><span>2</span></li>
						<li @touchstart="numberk(3)"><span>3</span></li>
						<li @touchstart="numberk(4)"><span>4</span></li>
						<li @touchstart="numberk(5)"><span>5</span></li>
						<li @touchstart="numberk(6)"><span>6</span></li>
						<li @touchstart="numberk(7)"><span>7</span></li>
						<li @touchstart="numberk(8)"><span>8</span></li>
						<li @touchstart="numberk(9)"><span>9</span></li>
						<li @touchstart="numberk('C')"><span>C</span></li>
						<li @touchstart="numberk(0)"><span>0</span></li>
						<li @touchstart="numberk('d')"><span><img src="../images/w/del.png"></span></li>
					</ul>
				</div>

			</div>

		</div>

	</body>

	<script type="text/javascript">
		var app = null;

		function refresh() {
			app.couponSn = "";
			app.init();
		}
		var getScan = getQueryString("scan");
		if(getScan == 1) {
			setTimeout(function() {
				app.gotoart("../qrcode/qrscan.html?id=0&type=1");
			}, 300)
		}
		function cli_backpre(){
			app.backpre()
		}

		function fun1() {
			
            setlange_obj(); //加载头部语言包
			app = new Vue({
				el: "#app",
				data: {
					b_lg: global_lange, //语言包
					couponSn: "",
					msg: "",
					shop_name: "",
					shop_list_name: "",
					h: "", //是否适用本店铺
					status: "", //优惠券状态

				},
				created: function() {
					this.init();
				},
				methods: {
					init: function() {
						common_ajax(1, {
							sn: this.couponSn
						}, "get_home", function(res) {
							if(res.status == 1) {
								app.shop_name = res.result.shop_info.shop_name;
							}
						})
					},
					numberk: function(e) { //按键
						var n = app.couponSn;
						switch(e) {
							case "d":
								n = n.substring(0, n.length - 1);
								break;
							case "C":
								n = "";
								break;
							default:
								//如果长度大于6
								if(n.length >= 6) {
									return;
								}
								n += e;
								break;
						}
						this.couponSn = n;
					},
					gotoart: function(e) {
						clicked(e);
					},
					sure: function() {
						if(this.couponSn.length != 6) {
							mui.toast(app.b_lg[1532])
							return false;
						}
						common_ajax(1, {
							sn: this.couponSn
						}, "get_coupon_info_bySn", function(res) {
							app.msg = res.msg;
							app.status = res.status;
							if(res.status == 1) {
								app.shop_list_name = res.result.info.shop_list_name;
								this.h = app.shop_list_name.indexOf(app.shop_name);
								app.status = res.result.info.status;
								if(app.h != -1 && app.status == 1) {
									app.gotoart('writeOffSuccess.html?id=1&sn=' + app.couponSn)
								}
							} else {
								mui.toast(res.msg);
							}
						})
					},
					scan: function() {
						setTimeout(function() {
							app.gotoart("../qrcode/qrscan.html?id=0&type=1");
						}, 500)
					},
					backpre: function() {
						if(isAPP) {
							var preUrl = plus.webview.currentWebview().opener();
							preUrl.evalJS("refresh()");
						}
						com_back();
					}
				}

			})
		}
	</script>

</html>
